<template>
    <view class="empty flex flex-direction justify-center align-center">
      <text class="text-gray empty-icon" :class="'cuIcon-' + icon"></text>
      <text class="padding-tb-xl">{{text}}</text>
      <view class="cu-btn" @click="go" v-if="btn">{{btnText}}</view>
    </view>
</template>
<script>
export default {
    props: {
      btn: {//按钮是否显示
        type: Boolean,
        default: true
      },
      text: {//提示文本
        type: String,
        default: '暂无更多..'
      },
      btnText: {//按钮文本
        type: String,
        default: '返回首页'
      },
      url: {//按钮跳转地址，默认首页
        type: String,
        default: '/pages/index/index'
      },
      icon: {//图标，对应colorUI的icon库
        type: String,
        default: 'shop'
      }
    },
    methods:{
      go(){
        let that = this;
        uni.navigateTo({
          url: that.url,
          fail(res){
            uni.switchTab({
              url: that.url
            });
          }
        });
      }
    }
  }
</script>
<style lang="scss">
.empty{
	min-height: 40vh;
	background: #fff;
	.empty-icon{
		font-size: 120upx;
	}
}
</style>
